/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package automatas;
import java.io.*;
/**
 *
 * @author 66038449
 */
public class Fichero {
public int Lineas;

public int cuentaArray(String fichero)throws Exception{
        BufferedReader input = new BufferedReader (new InputStreamReader (new FileInputStream(fichero)));

        int NumeroLineas = 0;
        String sCadena;

        while ((sCadena = input.readLine())!=null) {
            NumeroLineas++;
        }

        this.Lineas = NumeroLineas;
        return this.Lineas;
    }// Cuenta las lineas del Array y devuelve el numero de lineas totales

public String[] LeeFichero(String fichero)throws Exception{
    String[] Palabra = new String[this.Lineas];
    BufferedReader input = new BufferedReader (new InputStreamReader (new FileInputStream(fichero)));
    int i = 0;

    for(i=0;i<this.Lineas;i++){
        String s = input.readLine();
        Palabra[i] = s;
    }
    return Palabra;
}

}
